#define DEBUG
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

int main() {
  srand(time(0));
  int times, maxn;
  scanf("%d %d", &times, &maxn);
  for (int i=1; i<=times; i++) {
    FILE *in = fopen("number.in", "w");
    fprintf(in, "1\n%d", rand()%maxn+1);
    fclose(in);
    if (system("./0")) {
      printf("RE\n");
      return -1;
    }
    if (system("./0_bf")) {
      printf("RE at bf\n");
      return -1;
    }
    if (system("cmp number.out number_bf.out")) {
      printf("WA\n");
      return -1;
    }
  }
  return 0;
}
